<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        
        <title>
            
    
                Alternate Class Instrumentation
             &mdash; 
    SQLAlchemy 0.8 Documentation

        </title>
        
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/docs.css" type="text/css" />

    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
          URL_ROOT:    '../../',
          VERSION:     '0.8.2',
          COLLAPSE_MODINDEX: false,
          FILE_SUFFIX: '.html'
      };
    </script>
        <script type="text/javascript" src="../../_static/jquery.js"></script>
        <script type="text/javascript" src="../../_static/underscore.js"></script>
        <script type="text/javascript" src="../../_static/doctools.js"></script>
    <script type="text/javascript" src="../../_static/init.js"></script>
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
        <link rel="copyright" title="Copyright" href="../../copyright.html" />
    <link rel="top" title="SQLAlchemy 0.8 Documentation" href="../../index.html" />
        <link rel="up" title="ORM Extensions" href="index.html" />
        <link rel="next" title="Examples" href="../examples.html" />
        <link rel="prev" title="Hybrid Attributes" href="hybrid.html" />

    </head>
    <body>
        










<div id="docs-container">



<div id="docs-header">
    <h1>SQLAlchemy 0.8 Documentation</h1>

    <div id="docs-search">
    Search:
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" size="18" /> <input type="submit" value="Search" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>

    <div id="docs-version-header">
        Release: <span class="version-num">0.8.2</span> | Release Date: July 3, 2013


    </div>

</div>

<div id="docs-top-navigation">
    <div id="docs-top-page-control" class="docs-navigation-links">
        <ul>
            <li>Prev:
            <a href="hybrid.html" title="previous chapter">Hybrid Attributes</a>
            </li>
            <li>Next:
            <a href="../examples.html" title="next chapter">Examples</a>
            </li>

        <li>
            <a href="../../contents.html">Table of Contents</a> |
            <a href="../../genindex.html">Index</a>
            | <a href="../../_sources/orm/extensions/instrumentation.txt">view source
        </li>
        </ul>
    </div>

    <div id="docs-navigation-banner">
        <a href="../../index.html">SQLAlchemy 0.8 Documentation</a>
                » <a href="../index.html" title="SQLAlchemy ORM">SQLAlchemy ORM</a>
                » <a href="index.html" title="ORM Extensions">ORM Extensions</a>
        » 
                Alternate Class Instrumentation
             

        <h2>
            
                Alternate Class Instrumentation
            
        </h2>
    </div>

</div>

<div id="docs-body-container">

    <div id="docs-sidebar">
    <h3><a href="../../index.html">Table of Contents</a></h3>
    <ul>
<li><a class="reference internal" href="#">Alternate Class Instrumentation</a><ul>
<li><a class="reference internal" href="#api-reference">API Reference</a></li>
</ul>
</li>
</ul>


    <h4>Previous Topic</h4>
    <p>
    <a href="hybrid.html" title="previous chapter">Hybrid Attributes</a>
    </p>
    <h4>Next Topic</h4>
    <p>
    <a href="../examples.html" title="next chapter">Examples</a>
    </p>


    <h4>Quick Search</h4>
    <p>
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" size="18" /> <input type="submit" value="Search" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </p>

    </div>

    <div id="docs-body" class="withsidebar" >
        
<div class="section" id="module-sqlalchemy.ext.instrumentation">
<span id="alternate-class-instrumentation"></span><span id="instrumentation-toplevel"></span><h1>Alternate Class Instrumentation<a class="headerlink" href="#module-sqlalchemy.ext.instrumentation" title="Permalink to this headline">¶</a></h1>
<p>Extensible class instrumentation.</p>
<p>The <a class="reference internal" href="#module-sqlalchemy.ext.instrumentation" title="sqlalchemy.ext.instrumentation"><tt class="xref py py-mod docutils literal"><span class="pre">sqlalchemy.ext.instrumentation</span></tt></a> package provides for alternate
systems of class instrumentation within the ORM.  Class instrumentation
refers to how the ORM places attributes on the class which maintain
data and track changes to that data, as well as event hooks installed
on the class.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The extension package is provided for the benefit of integration
with other object management packages, which already perform
their own instrumentation.  It is not intended for general use.</p>
</div>
<p>For examples of how the instrumentation extension is used,
see the example <a class="reference internal" href="../examples.html#examples-instrumentation"><em>Attribute Instrumentation</em></a>.</p>
<p class="versionchanged">
<span class="versionmodified">Changed in version 0.8: </span>The <tt class="xref py py-mod docutils literal"><span class="pre">sqlalchemy.orm.instrumentation</span></tt> was split out so
that all functionality having to do with non-standard
instrumentation was moved out to <a class="reference internal" href="#module-sqlalchemy.ext.instrumentation" title="sqlalchemy.ext.instrumentation"><tt class="xref py py-mod docutils literal"><span class="pre">sqlalchemy.ext.instrumentation</span></tt></a>.
When imported, the module installs itself within
<tt class="xref py py-mod docutils literal"><span class="pre">sqlalchemy.orm.instrumentation</span></tt> so that it
takes effect, including recognition of
<tt class="docutils literal"><span class="pre">__sa_instrumentation_manager__</span></tt> on mapped classes, as
well <tt class="xref py py-attr docutils literal"><span class="pre">instrumentation_finders</span></tt>
being used to determine class instrumentation resolution.</p>
<div class="section" id="api-reference">
<h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to this headline">¶</a></h2>
<dl class="data">
<dt id="sqlalchemy.ext.instrumentation.INSTRUMENTATION_MANAGER">
<tt class="descclassname">sqlalchemy.ext.instrumentation.</tt><tt class="descname">INSTRUMENTATION_MANAGER</tt><em class="property"> = '__sa_instrumentation_manager__'</em><a class="headerlink" href="#sqlalchemy.ext.instrumentation.INSTRUMENTATION_MANAGER" title="Permalink to this definition">¶</a></dt>
<dd><p>Attribute, elects custom instrumentation when present on a mapped class.</p>
<p>Allows a class to specify a slightly or wildly different technique for
tracking changes made to mapped attributes and collections.</p>
<p>Only one instrumentation implementation is allowed in a given object
inheritance hierarchy.</p>
<p>The value of this attribute must be a callable and will be passed a class
object.  The callable must return one of:</p>
<blockquote>
<div><ul class="simple">
<li>An instance of an InstrumentationManager or subclass</li>
<li>An object implementing all or some of InstrumentationManager (TODO)</li>
<li>A dictionary of callables, implementing all or some of the above (TODO)</li>
<li>An instance of a ClassManager or subclass</li>
</ul>
</div></blockquote>
<p>This attribute is consulted by SQLAlchemy instrumentation
resolution, once the <a class="reference internal" href="#module-sqlalchemy.ext.instrumentation" title="sqlalchemy.ext.instrumentation"><tt class="xref py py-mod docutils literal"><span class="pre">sqlalchemy.ext.instrumentation</span></tt></a> module
has been imported.  If custom finders are installed in the global
instrumentation_finders list, they may or may not choose to honor this
attribute.</p>
</dd></dl>

<dl class="class">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager">
<em class="property">class </em><tt class="descclassname">sqlalchemy.ext.instrumentation.</tt><tt class="descname">InstrumentationManager</tt><big>(</big><em>class_</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager" title="Permalink to this definition">¶</a></dt>
<dd><p>User-defined class instrumentation extension.</p>
<p><a class="reference internal" href="#sqlalchemy.ext.instrumentation.InstrumentationManager" title="sqlalchemy.ext.instrumentation.InstrumentationManager"><tt class="xref py py-class docutils literal"><span class="pre">InstrumentationManager</span></tt></a> can be subclassed in order
to change
how class instrumentation proceeds. This class exists for
the purposes of integration with other object management
frameworks which would like to entirely modify the
instrumentation methodology of the ORM, and is not intended
for regular usage.  For interception of class instrumentation
events, see <a class="reference internal" href="../events.html#sqlalchemy.orm.events.InstrumentationEvents" title="sqlalchemy.orm.events.InstrumentationEvents"><tt class="xref py py-class docutils literal"><span class="pre">InstrumentationEvents</span></tt></a>.</p>
<p>The API for this class should be considered as semi-stable,
and may change slightly with new releases.</p>
<p class="versionchanged">
<span class="versionmodified">Changed in version 0.8: </span><a class="reference internal" href="#sqlalchemy.ext.instrumentation.InstrumentationManager" title="sqlalchemy.ext.instrumentation.InstrumentationManager"><tt class="xref py py-class docutils literal"><span class="pre">InstrumentationManager</span></tt></a> was moved from
<tt class="xref py py-mod docutils literal"><span class="pre">sqlalchemy.orm.instrumentation</span></tt> to
<a class="reference internal" href="#module-sqlalchemy.ext.instrumentation" title="sqlalchemy.ext.instrumentation"><tt class="xref py py-mod docutils literal"><span class="pre">sqlalchemy.ext.instrumentation</span></tt></a>.</p>
<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.dict_getter">
<tt class="descname">dict_getter</tt><big>(</big><em>class_</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.dict_getter" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.dispose">
<tt class="descname">dispose</tt><big>(</big><em>class_</em>, <em>manager</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.dispose" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.get_instance_dict">
<tt class="descname">get_instance_dict</tt><big>(</big><em>class_</em>, <em>instance</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.get_instance_dict" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.initialize_instance_dict">
<tt class="descname">initialize_instance_dict</tt><big>(</big><em>class_</em>, <em>instance</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.initialize_instance_dict" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.install_descriptor">
<tt class="descname">install_descriptor</tt><big>(</big><em>class_</em>, <em>key</em>, <em>inst</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.install_descriptor" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.install_member">
<tt class="descname">install_member</tt><big>(</big><em>class_</em>, <em>key</em>, <em>implementation</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.install_member" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.install_state">
<tt class="descname">install_state</tt><big>(</big><em>class_</em>, <em>instance</em>, <em>state</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.install_state" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.instrument_attribute">
<tt class="descname">instrument_attribute</tt><big>(</big><em>class_</em>, <em>key</em>, <em>inst</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.instrument_attribute" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.instrument_collection_class">
<tt class="descname">instrument_collection_class</tt><big>(</big><em>class_</em>, <em>key</em>, <em>collection_class</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.instrument_collection_class" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.manage">
<tt class="descname">manage</tt><big>(</big><em>class_</em>, <em>manager</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.manage" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.manager_getter">
<tt class="descname">manager_getter</tt><big>(</big><em>class_</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.manager_getter" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.post_configure_attribute">
<tt class="descname">post_configure_attribute</tt><big>(</big><em>class_</em>, <em>key</em>, <em>inst</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.post_configure_attribute" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.remove_state">
<tt class="descname">remove_state</tt><big>(</big><em>class_</em>, <em>instance</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.remove_state" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.state_getter">
<tt class="descname">state_getter</tt><big>(</big><em>class_</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.state_getter" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.uninstall_descriptor">
<tt class="descname">uninstall_descriptor</tt><big>(</big><em>class_</em>, <em>key</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.uninstall_descriptor" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.uninstall_member">
<tt class="descname">uninstall_member</tt><big>(</big><em>class_</em>, <em>key</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.uninstall_member" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="data">
<dt id="sqlalchemy.ext.instrumentation.instrumentation_finders">
<tt class="descclassname">sqlalchemy.ext.instrumentation.</tt><tt class="descname">instrumentation_finders</tt><em class="property"> = [&lt;function find_native_user_instrumentation_hook at 0x10b64b758&gt;]</em><a class="headerlink" href="#sqlalchemy.ext.instrumentation.instrumentation_finders" title="Permalink to this definition">¶</a></dt>
<dd><p>An extensible sequence of callables which return instrumentation
implementations</p>
<p>When a class is registered, each callable will be passed a class object.
If None is returned, the
next finder in the sequence is consulted.  Otherwise the return must be an
instrumentation factory that follows the same guidelines as
sqlalchemy.ext.instrumentation.INSTRUMENTATION_MANAGER.</p>
<p>By default, the only finder is find_native_user_instrumentation_hook, which
searches for INSTRUMENTATION_MANAGER.  If all finders return None, standard
ClassManager instrumentation is used.</p>
</dd></dl>

<dl class="class">
<dt id="sqlalchemy.ext.instrumentation.ExtendedInstrumentationRegistry">
<em class="property">class </em><tt class="descclassname">sqlalchemy.ext.instrumentation.</tt><tt class="descname">ExtendedInstrumentationRegistry</tt><a class="headerlink" href="#sqlalchemy.ext.instrumentation.ExtendedInstrumentationRegistry" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.orm.instrumentation.InstrumentationFactory</span></tt></p>
<p>Extends <tt class="xref py py-class docutils literal"><span class="pre">InstrumentationFactory</span></tt> with additional
bookkeeping, to accommodate multiple types of
class managers.</p>
</dd></dl>

</div>
</div>

    </div>

</div>

<div id="docs-bottom-navigation" class="docs-navigation-links">
        Previous:
        <a href="hybrid.html" title="previous chapter">Hybrid Attributes</a>
        Next:
        <a href="../examples.html" title="next chapter">Examples</a>

    <div id="docs-copyright">
        &copy; <a href="../../copyright.html">Copyright</a> 2007-2013, the SQLAlchemy authors and contributors.
        Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>
</div>

</div>

        
    </body>
</html>


